SUBROUTINE TAG_ATTR
* Create a simple table using RWS_TAG and RWA_TAG_ATTR.
* Include the RealWeb definitions.
INCLUDE #RW.INCLUDE.DEFS FROM /SYSFILES/REALWEB,BP
EQU AM TO CHAR(254)
* Start the HTML page.CALL RW_START_HTML_PAGE("Table Example using RWA_TAG_ATTR", "", "", "", "")* Initialise the HTML string buffer.
HTML = ""
* Create a caption for the table.
TEXT = "Areas giving rise to faults in software"
CALL RWS_TAG(TEXT, "caption", "")
HTML = HTML : TEXT
* Assemble some data to go in the table.
ROW = ""
* Tags.
TAGS = "th":AM:"th"
* Headings.
DATA = "Phase giving rise to fault":AM:"Percentage of total faults"
* Tag the data as heading cells.CALL RWA_TAG_ATTR(ROW, TAGS, DATA, 1, "")* Tag the text as a table row.CALL RWS_TAG(ROW, "tr", "")
HTML = HTML : ROW
* Tags.
TAGS = "td":AM:"td"
* Data.
ROW = ""
DATA = "Requirements definition":AM:"38"
* Tag the data as table cells.CALL RWA_TAG_ATTR(ROW, TAGS, DATA, 1, "")CALL RWA_TAG(HTML, "tr", ROW, "")
ROW = ""
DATA = "Maintenance (operation)":AM:"32"
CALL RWA_TAG_ATTR(ROW, TAGS, DATA, 1, "")CALL RWA_TAG(HTML, "tr", ROW, "")
ROW = ""
DATA = "Design":AM:"23"
CALL RWA_TAG_ATTR(ROW, TAGS, DATA, 1, "")CALL RWA_TAG(HTML, "tr", ROW, "")
ROW = ""
DATA = "Installation":AM:"7"
CALL RWA_TAG_ATTR(ROW, TAGS, DATA, 1, "")CALL RWA_TAG(HTML, "tr", ROW, "")* Create the table.
aClass = ""
aClass<2> = "border=border"
CALL RWS_TAG(HTML, "table", aClass)* Output the HTML.CALL RW_PUT(HTML)* Complete the page.CALL RW_END_PAGE
RETURN
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><HTML><HEAD><META NAME="Generator" CONTENT="Reality"><TITLE>Table Example using RWA_TAG_ATTR</TITLE></HEAD><BODY><table border=border><caption>Areas giving rise to faults in software</caption><tr><th>Phase giving rise to fault</th><th>Percentage of total faults</th></tr><tr><td>Requirements definition</td><td>38</td></tr><tr><td>Maintenance (operation)</td><td>32</td></tr><tr><td>Design</td><td>23</td></tr><tr><td>Installation</td><td>7</td></tr></table></BODY></HTML>